package java_regex;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class MatchText {

	public static void main(String[] args) {
		ArrayList<String> text = new ArrayList<>(); 
		String regEx = "";
		
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
			String line = "";
			
			System.out.println("Enter Input text...Enter to Quit");
			while ((line = reader.readLine()) != null && line.length()!= 0) {
				text.add(line);
			}
			
			System.out.println("Enter RegEx");
			regEx = reader.readLine();
			
		
		if (text == null || text.size() == 0){
			System.out.println("Input Text is empty");
			return;
		}
		
		if (regEx.length() == 0) {
			System.out.println("RegEx is empty");
			return;
		}
		
		String result = "";
		for (String s: text){
			result = s.matches(regEx)? s + " - True" : s + " - False";
			System.out.println(result);
		}
		
		
		} catch (IOException ex) {
			System.out.println(ex);
		}
		
	}

}